package roborally.program.text;

/**
 * An interface specifying the methods a procedure should have. The procedure must be able to return
 * a string pattern of which a valid procedure can be constructed. Also in case of parameters,
 * the procedure must be able to convert the parameters to a String representation and from a String
 * representation to the right objects. This transformation must form an isomorfism.
 * 
 * @author Molderez Tom, 2de bach Ingenieurswetenschappen Computerwetenschappen-Elektrotechniek and Reniers Jorn, 2de bach Ingenieurswetenschappen Werktuigkunde-Computerwetenschappen
 * @version 1.0
 *
 */
public interface TextProcedure extends SimpleTextProcedure {
	
	/**
	 * Returns the String representation of this object if valid.
	 * 
	 * @param value The object from which a String representation is asked.
	 * @return Null will never be returned.
	 * 		| result != null
	 * @throws IllegalArgumentException
	 * 		When the command can not contain this object as an parameter.
	 * 		| !containsValue(value)
	 */
	public abstract String getArgument(Object value) throws IllegalArgumentException;
	
	/**
	 * Returns if the procedure can contain the object as parameter for execution.
	 * 
	 * @param value The value to be controlled.
	 */
	public abstract boolean containsValue(Object value);
	
	/**
	 * Returns the object of the given String parameter if valid.
	 * 
	 * @param argument The argument of which the corresponding object must be returned.
	 * @return Null will never be returned.
	 * 		| result != null
	 * @throws IllegalArgumentException
	 * 		When the command can not contain the given String argument as parameter.
	 * 		| !containsArgument(argument)
	 */
	public abstract Object getValue(String argument) throws IllegalArgumentException;

	/**
	 * Returns if the procedure can contain the argument as parameter for execution.
	 * 
	 * @param argument The argument to be controlled.
	 */
	public abstract boolean containsArgument(String argument);

}
